package forms;

import javax.servlet.http.HttpServletRequest;

import model.StudentModel;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.*;

public class appsForm extends ActionForm
{
	/**
	 * Validate the input data. If validation fails, then report the errors in
	 * students.jsp, and specifically where <html:errors/> is located.
	 * 
	 * @param mapping
	 *            The mapping used to select this instance
	 * @param request
	 *            The servlet request we are processing
	 */
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request)
	{
		ActionErrors errors = new ActionErrors();
		
		int numRev = 0;
		
		numRev = StudentModel.numReviewers();
		
		if( numRev < 3 )
		{
			errors.add("numRev", new ActionMessage("error.numRev.lessThree"));
		}

		return errors;
	}

}
